#include "rbtree.h"
#include <stdio.h>
#define BUFFER_SIZE 10
int pCompare(ELEMENTTYPE val1, ELEMENTTYPE val2)
{
    int num1 = *(int *)val1;
    int num2 = *(int *)val2;
    if (num1 > num2)
    {
        return 1;
    }
    else if (num1 < num2)
    {
        return -1;
    }
    else
    {
        return 0;
    }
}
void printBasicDataType(ELEMENTTYPE val)
{
    int num = *(int *)val;
    printf("%d\t", num);
}
int main()
{
    Rbtree *tree = NULL;
    rbtreeInit(&tree, pCompare, printBasicDataType);
    // int num = 10;
    // rbtreeInsert(tree, (void *)&num);

    int arr[BUFFER_SIZE] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    for (int idx = 0; idx < BUFFER_SIZE; idx++)
    {
        rbtreeInsert(tree, (void *)&arr[idx]);
    }
    printf("size=%d\n", tree->size);
    rbtreeLevelPrint(tree);
    int high = 0;
    rbtreeGetHeight(tree, &high);
    printf("high=%d\n", high);
    rbtreeDestroy(tree);
}